package test.heliotrope.display
{
	import flash.display.Graphics;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.geom.Matrix;
	import flash.geom.Transform;
	
	import heliotrope.display.RegSprite;
	import heliotrope.utils.CompassDirection;
	
	import org.hamcrest.object.nullValue;

	public class RegSpriteTest extends Sprite
	{
		private var _sp:RegSprite;
		public function RegSpriteTest()
		{
			//====Please reserve the two lines below====
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			//=========================================
//			_sp = new RegSprite(CompassDirection.NW);
			_sp = new RegSprite(CompassDirection.NW);
			var tmp:Sprite = new Sprite;
			var g:Graphics = tmp.graphics;
			g.beginFill(0xFF0000);
			g.drawRect(0,0,128,128);
			g.endFill();
			var tmp2:Sprite = new Sprite;
			var g2:Graphics = tmp2.graphics;
			g2.beginFill(0xFFFF00);
			g2.drawCircle(0,0,64);
			g2.endFill();
			//addChild(tmp);
//			_sp.addChild(tmp);
			_sp.x = 300;
			_sp.y = 300;
			_sp.addChild(tmp2);
			_sp.mask = tmp;
//			tmp.x = 300;
//			tmp.y = 300;
//			tmp.x = -64;
//			tmp.y = -64;
			_sp.addChild(tmp);	
			var p:Sprite = new Sprite;
			p.graphics.beginFill(0x0000FF);
			p.graphics.drawCircle(300,300,10);
			p.graphics.endFill();
//			addChild(tmp);
//			addChild(tmp2);
			addChild(_sp);
			addChild(p);
//			_sp.regPoint = [64,64];
//			_sp.rotation = 180;
//			_sp.regPoint = null;
//			trace(this.getBounds(this));
//			var mtx:Matrix = new Matrix;
//			mtx.tx = 32;
//			tmp.transform.matrix = mtx;
//			trace(tmp.x);
//			addChild(tmp);
			//_sp.refresh();
			//this.addEventListener(Event.ADDED, tr);
		}
		
		protected function tr(event_:Event):void
		{
			// TODO Auto-generated method stub
			trace(event_);
		}
	}
}